package com.jackiechancinema.ssm.vo;

import com.jackiechancinema.ssm.config.SystemContant;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
public class R {
    private int code;
    private String msg;
    private Object data;

    public R() {
    }

    public R(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    /**
     * @description: 成功的返回
     * @param msg
     * @param data
     * @return:
     */
    public static R ok(String msg, Object data){
        return new R(SystemContant.R_OK,msg,data);
    }
    /**
     * @description: 成功的返回
     * @param data
     * @return:
     */
    public static R ok( Object data){
        return new R(SystemContant.R_OK,"OK",data);
    }
    /**
     * @description: 失败的返回
     * @param msg
     * @return:
     */
    public static R fail(String msg){
        return new R(SystemContant.R_FAIL,msg,null);
    }
    /**
     * @description: 失败的返回
     * @return:
     */
    public static R fail(){
        return new R(SystemContant.R_FAIL,"FAIL",null);
    }
}
